using System.Collections.Generic;
using UnityEngine;
using System;
using Map;

public static partial class ServerNet
{
	/// <summary>
	/// 回应登录
	/// </summary>
	public static void SendResLoginMessage(long cid,int State,long PlayerId,int RoleId,String PlayerName)
	{
		Map.ResLoginMessage msg = ServerMessagePool.Instance.Fetch<Map.ResLoginMessage>();
		msg.State = State;
		msg.PlayerId = PlayerId;
		msg.RoleId = RoleId;
		msg.PlayerName = PlayerName;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 回应创建一个房间
	/// </summary>
	public static void SendResCreateRoomMessage(long cid,int RoomId,String RoomName,String RoomPassword)
	{
		Map.ResCreateRoomMessage msg = ServerMessagePool.Instance.Fetch<Map.ResCreateRoomMessage>();
		msg.RoomId = RoomId;
		msg.RoomName = RoomName;
		msg.RoomPassword = RoomPassword;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 回应玩家创建角色
	/// </summary>
	public static void SendResCreateRoleMessage(long cid,int RoleId)
	{
		Map.ResCreateRoleMessage msg = ServerMessagePool.Instance.Fetch<Map.ResCreateRoleMessage>();
		msg.RoleId = RoleId;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 回应登录房间信息
	/// </summary>
	public static void SendResJoinRoomMapMessage(long cid,int RoomId,int State)
	{
		Map.ResJoinRoomMapMessage msg = ServerMessagePool.Instance.Fetch<Map.ResJoinRoomMapMessage>();
		msg.RoomId = RoomId;
		msg.State = State;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 回应玩家离开房间
	/// </summary>
	public static void SendResLeaveRoomMapMessage(long cid,int Res)
	{
		Map.ResLeaveRoomMapMessage msg = ServerMessagePool.Instance.Fetch<Map.ResLeaveRoomMapMessage>();
		msg.Res = Res;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 房间信息
	/// </summary>
	public static void SendResRoomInfoMessage(long cid,int Id,int RoomState,String Name,String Password)
	{
		Map.ResRoomInfoMessage msg = ServerMessagePool.Instance.Fetch<Map.ResRoomInfoMessage>();
		msg.Id = Id;
		msg.RoomState = RoomState;
		msg.Name = Name;
		msg.Password = Password;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 战斗开始了
	/// </summary>
	public static void SendResBattleStartMessage(long cid,int Seed)
	{
		Map.ResBattleStartMessage msg = ServerMessagePool.Instance.Fetch<Map.ResBattleStartMessage>();
		msg.Seed = Seed;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 帧同步指令消息
	/// </summary>
	public static void SendResLockStepCommandMessage(long cid,int FrameIndex)
	{
		Map.ResLockStepCommandMessage msg = ServerMessagePool.Instance.Fetch<Map.ResLockStepCommandMessage>();
		msg.FrameIndex = FrameIndex;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 战斗结束
	/// </summary>
	public static void SendResBattleEndMessage(long cid,String WinPlayerName)
	{
		Map.ResBattleEndMessage msg = ServerMessagePool.Instance.Fetch<Map.ResBattleEndMessage>();
		msg.WinPlayerName = WinPlayerName;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 房间简介列表
	/// </summary>
	public static void SendResRoomListInfoMessage(long cid)
	{
		Map.ResRoomListInfoMessage msg = ServerMessagePool.Instance.Fetch<Map.ResRoomListInfoMessage>();
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 新增房间信息
	/// </summary>
	public static void SendResRoomAddMessage(long cid,RoomBrief RoomInfo)
	{
		Map.ResRoomAddMessage msg = ServerMessagePool.Instance.Fetch<Map.ResRoomAddMessage>();
		msg.RoomInfo = RoomInfo;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 删除的房间信息
	/// </summary>
	public static void SendResRoomRemovedMessage(long cid,int RoomId)
	{
		Map.ResRoomRemovedMessage msg = ServerMessagePool.Instance.Fetch<Map.ResRoomRemovedMessage>();
		msg.RoomId = RoomId;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
	/// <summary>
	/// 房间信息变更
	/// </summary>
	public static void SendResRoomUpdatedMessage(long cid,RoomBrief RoomInfo)
	{
		Map.ResRoomUpdatedMessage msg = ServerMessagePool.Instance.Fetch<Map.ResRoomUpdatedMessage>();
		msg.RoomInfo = RoomInfo;
		ServerNetManager.Instance.Send(cid,msg);
		ServerMessagePool.Instance.Recycle(msg);
	}
}
